package com.xhwl.data.service;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.xhwl.common.dto.cent.sdata.GroupDTO;
import com.xhwl.common.pojo.ResultJson;
import com.xhwl.common.pojo.cent.sdata.GroupAccount;
import com.xhwl.common.query.cent.sdata.GroupQuery;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author JCccc
 * @Description
 * @Date 2021/6/15 16:56
 */
@RestController
public interface IGroupAccountService extends IService<GroupAccount> {

    /**
     * 新增用户组账号权限 关联关系 （先删除后新增）
     *
     * @param groupId
     * @param accountIds
     */
    @RequestMapping(value = "/group-account-service/create", method = RequestMethod.POST)
    ResultJson createGroupAccount(@RequestPart("groupId") Integer groupId, @RequestPart("accountIds") List<Integer> accountIds);


    /**
     * 新增 用户组和账号 ，新增以前没有的账号关联
     *
     * @param groupId
     * @param accountIds
     */
    @RequestMapping(value = "/group-account-service/add", method = RequestMethod.POST)
    ResultJson addGroupAccount(@RequestPart("groupId") Integer groupId, @RequestPart("accountIds") List<Integer> accountIds);

    /**
     * 删除用户组账号权限  关联关系
     *
     * @param groupIds
     * @param accountIds
     */
    @RequestMapping(value = "/group-account-service/delete", method = RequestMethod.POST)
    ResultJson deleteGroupAccount(@RequestPart(value = "groupIds") List<Integer> groupIds, @RequestPart(value = "accountIds") List<Integer> accountIds);


    /**
     * 查找账号和组关系
     * @param groupIds
     * @param accountIds
     * @return
     */
    @RequestMapping(value = "/group-account-service/getList", method = RequestMethod.POST)
    List<GroupAccount> getList(@RequestPart(value = "groupIds")List<Integer> groupIds, @RequestPart(value = "accountIds")List<Integer> accountIds);

    /**
     * 分页获取组信息
     * @param page
     * @param groupQuery
     * @return
     */
    @RequestMapping(value = "/group-service/getGroupPageList", method = RequestMethod.POST)
    Page<GroupDTO> getGroupPageList(@RequestPart("page") Page page, @RequestPart("groupQuery") GroupQuery groupQuery);

}
